<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>管理员登录页面</title>
<base href="<%=basePath%>">
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<link href="css/style.css" rel='stylesheet' type='text/css' />
<script type="text/javascript">
$(function(){
	if (window != top) {
		var tip = "${tips}";
		top.location.href = location.href;  
		setTimeout(function(){
			layer.msg(tip);
		},2000);
	} 
}) 
</script>
</head>
<body>
<div class="main">
		<div class="login">
			<h1>java189后台管理系统</h1>
			<div class="inset">
				<!--start-main-->
				<form>
			         <div>
			         	<h2>内部用户登录</h2>
						<span><label>用户名</label></span>
						<span><input type="text" class="textbox" id="uname" value="test"></span>
					 </div>
					 <div>
						<span><label>密码</label></span>
					    <span><input type="password" class="password" id="upass" value="test"></span>
					 </div>
					<div class="sign">
                        <input type="button" id="login" value="登录" class="submit" onclick="staffLogin();" />
					</div>
					</form>
				</div>
			</div>
		<!--//end-main-->
		</div>

<div class="copy-right">
	<p>&copy; 2016 All Copy Rights</p>

</div>
</body>
<script type="text/javascript">
	//全局回车事件
	$(function(){
		document.onkeydown = function(e){ 
		    var ev = document.all ? window.event : e;
		    if(ev.keyCode==13) {
		    	$.ajax({
					url : 'admin/AdStaffLogin.do',
					type : "POST",
					dataType : "json",						
					data :{
						staffAccount:$("#uname").val(),
						staffPassword:$("#upass").val()
					},
					success : function(result) {
						if (result.result == 0) {
							setInterval(layer.msg(result.tips),3);
							//location.href='admin/adminlogin.do'
						} else {
							setInterval(layer.msg(result.tips),3);
							location.href='admin/MainMenu.do'
						}
					}
			}); 
		     }
		}
	});
	//登录按钮
	function staffLogin(){
		$.ajax({
			url : 'admin/AdStaffLogin.do',
			type : "POST",
			dataType : "json",						
			data :{
				staffAccount:$("#uname").val(),
				staffPassword:$("#upass").val()
			},
			success : function(result) {
				if (result.result == 0) {
					layer.msg(result.tips);
					//location.href='admin/adminlogin.do'
				} else {
					layer.msg(result.tips);
					setInterval("location.href='admin/MainMenu.do'",1000);
				}
			}
	}); 
	}
</script>
</html>